/*
 * @Author: funlee
 * @Email: i@funlee.cn
 * @Date: 2018-10-29 21:56:08
 * @Description: ajax 请求 
 */

define(function() {
  var request = {
    /**
     *  @describe [发送get请求]
     *  @param    {string}   url  [请求地址]
     *  @param    {Function} callback [回调函数]
     */
    sendAjax: function(url, params, callback){
      $.ajax({
        type:'get',
        dataType: 'json',
        url: url,
        data: params,
        success: function(response){
          if (!response.status) {
            alert('调后台接口失败')
          }
          callback && callback(response.result)
        },
        error: function(){
          alert('请求失败: 系统错误')
        }
      })
    }
  }
  return request;
})  
